<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>{$meta_title}</title>
  
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="">
  <link rel="apple-touch-icon-precomposed" href="">
  <meta name="apple-mobile-web-app-title" content="{$meta_title}" />
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="__ROOT__/Application/Home/View/default/assets/css/admin.css">

  <script type="text/javascript">var _config = <?php echo Auth::getConfig();?></script>
  <script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/zepto.min.js"></script>
  <script type="text/javascript" src="https://g.alicdn.com/ilw/ding/0.8.9/scripts/dingtalk.js"></script>
  <script type="text/javascript" src="__PUBLIC__/libs/dingding/javascripts/logger.js"></script>
</head>
<body>
<style>
.am-btn{    border: 1px solid #ccc;    margin-bottom: 10px;}
</style>
<div class="am-cf admin-main">
 
<!-- content start -->
<div class="admin-content">
  <div class="admin-content-body">
    <div style="height:10px;"></div>
      
<form class="am-form" id="projectform" action="/Wap/Project/edit" method="post">
             
                         
			  <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">项目编号</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <input type="text" class="am-input-sm"  name="project_number" value="{$info.project_number}">
	              <input type="hidden"  name="id" value="{$info.id}">
	            </div>
	          </div>
	          
	          <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">项目名称</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <input type="text" class="am-input-sm"  name="project_name" value="{$info.project_number}">
	            </div>
	          </div>

			<div class="am-g am-margin-top">
             <div class="am-u-sm-3 am-u-md-2 am-text-right">搜索客户</div>
             <div class="am-u-sm-8 am-u-md-4 am-u-end" >
	          <div class="am-input-group am-input-group-sm">
	            <input type="text" class="am-form-field" id="so_customer" placeholder="请输入客户名/编号/手机号">
	          <span class="am-input-group-btn">
	            <button class="am-btn am-btn-default" type="button" id="search">搜索</button>
	          </span>
	          </div>
	        </div>
             </div>
             
			  <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">客户</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <select name="customerid" id="customer_id">
	              	<volist name="customer" id="vo" >
	                <option value="{$key}" <if condition="$key eq $info.customerid " >selected = "selected"</if>>{$vo}</option>
	                </volist>
	              </select>
	            </div>
	          </div>
	          
	          <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                负责人
              </div>
              <div class="am-u-sm-8 am-u-md-10 am-u-end col-end">
              	              	
              	<div class='am-btn' id='header'>{$header.name}<span onclick='del_header();'>X</span><input type='hidden' name='responsible_person' id='header1' value='{$header.id}'></div>
	            <button class="am-btn am-btn-default" type="button" id="find_header">选人</button>
	                       
              </div>
            </div>

            <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                开发人员
              </div>
              <div class="am-u-sm-8 am-u-md-10 am-u-end col-end">
              	              	
              	<volist name="kaifa" id="vo" >
              	<div class='am-btn' id='user_{:1+$key}'>{$vo.name}<span onclick='del_user({:1+$key});'>X</span><input type='hidden' name='uid{:1+$key}' id='uid{:1+$key}' value='{$vo.ding_id}'></div>
              	</volist>
              	<button class="am-btn am-btn-default" type="button" id="find_uid">选人</button>
	                        
              </div>
            </div>
            
             <div class="am-g am-margin-top">
	            <div class="am-u-sm-3 am-u-md-2 am-text-right">客服</div>
	            <div class="am-u-sm-8 am-u-md-4 am-u-end ">
	              <select name="customer_service_id" id="">
	              	<volist name="kefu_arr" id="vo" key="k">
	                <option value="{$vo.id}" <if condition="$vo.id eq $info.customer_service_id " >selected = "selected"</if>>{$vo.title}</option>
	                </volist>
	              </select>
	            </div>
	          </div>  
	          
	         <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                开始时间
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
	              <div class="am-input-group am-input-group-sm">
		            <input type="text" class="am-form-field" id="s_time"  name="contract_start_time" value="{$info.contract_start_time|date='Y-m-d H:m',###}" >
		          	<span class="am-input-group-btn">
		            	<button class="am-btn am-btn-default" type="button" id="stime">选择</button>
		          	</span>
		          </div>
               
              </div>
            </div>  
	          
	          <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                结束时间
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
              	  <div class="am-input-group am-input-group-sm">
		            <input type="text" class="am-form-field" id="e_time"  name="contract_end_time" value="{$info.contract_end_time|date='Y-m-d H:m',###}">
		          	<span class="am-input-group-btn">
		            	<button class="am-btn am-btn-default" type="button" id="etime">选择</button>
		          	</span>
		          </div>
                
              </div>
            </div>  

			
               
             <div class="am-g am-margin-top">
              <div class="am-u-sm-3 am-u-md-2 am-text-right">
                总金额
              </div>
              <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                <input type="text" class="am-input-sm"  name="total_amount" value="{$info.total_amount}">
                
              </div>
            </div>     

            <div class="am-g am-margin-top-sm">
              <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">
                备注
              </div>
              <div class="am-u-sm-12 am-u-md-6 am-u-end">
                <textarea rows="4" name="remark" placeholder="请填写任务详细">{$info.remark}</textarea>
              </div>
            </div>

          </form>
   
	<div class="am-margin">
      <button type="button" class="am-btn am-btn-primary am-btn-xs" id="saveproject">提交保存</button>
      <button type="button" class="am-btn am-btn-primary am-btn-xs" onClick="javascript :history.back(-1);">放弃保存</button>
    </div>
<div style="height:80px;"></div>
  </div>
</div>
<!-- content end -->

</div>

<script type="text/javascript" >

//搜索客户
$('#search').click(function(){
	var keyword=$('#so_customer').val();
	var params = {};
	params.keyword=keyword;
	
	var url="{:U('Wap/Server/getCustomerAjax')}";
	$.post(url,params,function(data) {
		
			$('#customer_id').html(data);
		
	});
});

//开始日期
var stime="{$info.contract_start_time|date='Y-m-d H:m',###}";
$('#stime').click(function(){
	dd.biz.util.datetimepicker({
	    format: 'yyyy-MM-dd HH:mm',
	    value: stime, //默认显示
	    onSuccess : function(result) {
	        //onSuccess将在点击完成之后回调
	        $('#s_time').val(result.value);
	       
	    },
	    onFail : function() {}
	});
});
//到期日期
var etime="{$info.contract_end_time|date='Y-m-d H:m',###}";
$('#etime').click(function(){
	dd.biz.util.datetimepicker({
	    format: 'yyyy-MM-dd HH:mm',
	    value: etime, //默认显示
	    onSuccess : function(result) {
	        //onSuccess将在点击完成之后回调
	        $('#e_time').val(result.value);
	       
	    },
	    onFail : function() {}
	});
});


//选人
dd.config({
           agentId: _config.agentId,
           corpId: _config.corpId,
           timeStamp: _config.timeStamp,
           nonceStr: _config.nonceStr,
           signature: _config.signature,
           jsApiList: [
           	'runtime.permission.requestAuthCode',
               'runtime.info',
               'device.base.getUUID',
               'device.notification.prompt',
               'device.base.getInterface',
               'biz.chat.pickConversation',
               'device.notification.confirm',
               'device.notification.alert',
               'device.notification.prompt',
               'biz.chat.open',
               'biz.util.open',
               'biz.user.get',
               'biz.contact.choose',
               'biz.telephone.call',
               'biz.ding.post',
               'ui.pullToRefresh.enable',
               'biz.navigation.setRight'
               ]
       });
       
dd.ready(function() {
	//禁用下拉刷新
		dd.ui.pullToRefresh.disable();
		//右侧
		dd.biz.navigation.setRight({
		    show: false,//控制按钮显示， true 显示， false 隐藏， 默认true
		    control: false,//是否控制点击事件，true 控制，false 不控制， 默认false
		    text: '',//控制显示文本，空字符串表示显示默认文本
		    onSuccess : function(result) {
		    	
		        //如果control为true，则onSuccess将在发生按钮点击事件被回调
		        /*
		        {}
		        */
		    },
		    onFail : function(err) {}
		});
		
		$('#find_header').on('click', function() {
	 		var header=[];
     		if($('#header1').val()){
     			header[0] =$('#header1').val();
     		}
 
			 	dd.biz.contact.choose({
				  startWithDepartmentId: 0, //-1表示打开的通讯录从自己所在部门开始展示, 0表示从企业最上层开始，(其他数字表示从该部门开始:暂时不支持)
				  multiple: false, //是否多选： true多选 false单选； 默认true
				  users: header, //默认选中的用户列表，userid；成功回调中应包含该信息
				  disabledUsers:[],// 不能选中的用户列表，员工userid
				  corpId: _config.corpId, //企业id
				  max: 5, //人数限制，当multiple为true才生效，可选范围1-1500
				  limitTips:"超过限制人数", //超过人数限制的提示语可以用这个字段自定义
				  isNeedSearch: true, // 是否需要搜索功能
				  title : "选人", // 如果你需要修改选人页面的title，可以在这里赋值 
				  local:false, // 是否显示本地联系人，默认false
				  onSuccess: function(data) {
				  //onSuccess将在选人结束，点击确定按钮的时候被回调
					  $('#header').remove();
			   		var html ="<div class='am-btn' id='header'>"+data[0].name+"<span onclick='del_header();'>X</span><input type='hidden' name='responsible_person' id='header1' value='"+data[0].emplId+"'></div>"
			   		$('#find_header').before(html); 
				 
				  },
				  onFail : function(err) {}
			  });
 
		});
		
		 $('#find_uid').on('click', function() {
		 	var lens = 5;
			var user=[];
	     	for (var a = 1; a <= lens; a++)
	     	{
	     		if($('#uid'+a).val()){
	     			user[a-1] =$('#uid'+a).val();
	     		}
	     		
	     	} 
				dd.biz.contact.choose({
				  startWithDepartmentId: 0, //-1表示打开的通讯录从自己所在部门开始展示, 0表示从企业最上层开始，(其他数字表示从该部门开始:暂时不支持)
				  multiple: true, //是否多选： true多选 false单选； 默认true
				  users: user, //默认选中的用户列表，userid；成功回调中应包含该信息
				  disabledUsers:[],// 不能选中的用户列表，员工userid
				  corpId: _config.corpId, //企业id
				  max: 5, //人数限制，当multiple为true才生效，可选范围1-1500
				  limitTips:"超过限制人数", //超过人数限制的提示语可以用这个字段自定义
				  isNeedSearch: true, // 是否需要搜索功能
				  title : "选人", // 如果你需要修改选人页面的title，可以在这里赋值 
				  local:false, // 是否显示本地联系人，默认false
				  onSuccess: function(data) {
				  //onSuccess将在选人结束，点击确定按钮的时候被回调
					var len = 5;
	            	for (var i = 1; i <= len; i++)
	            	{
	            		$('#user_'+i).remove();
	            		var html ="<div class='am-btn' id='user_"+i+"'>"+data[i-1].name+"<span onclick='del_user("+i+");'>X</span><input type='hidden' name='uid"+i+"' id='uid"+i+"' value='"+data[i-1].emplId+"'></div>"
	            		$('#find_uid').before(html); 
	            	} 
				 
				  },
				  onFail : function(err) {}
				});
		 });

 
 });
       
 
 function del_header(){
	 $('#header').remove();
 }
 
 function del_user(i){
	 $('#user_'+i).remove();
 }
//提交表单
	$('#saveproject').click(function(){
	 	$('#projectform').submit();
	});
</script>
<!-- footnav start --> 
<style>
.footnav{ position: fixed;  bottom: 0;    width: 100% ; background: #fff; z-index:999999}
.footnav ul{ padding:5px 0; border-top:1px solid #ccc}
.footnav ul li{ width:20%; float:left;list-style-type: none;}
.footnav ul li a{ display:block; text-align:center; font-size:12px;    color: #767171;}
.footnav ul li a span{ font-size:24px;line-height: 20px;}
.active a {color:#0e90d2 !important;}

</style>
<div class=" footnav">
    <ul>
    <li > <a  href="/Wap/Index/shouye" ><span class="am-icon-home"></span>首页 </a> </li>
     <li ><a href="/Wap/Task/mytask"><span class="am-icon-file-text"></span>任务</a></li>
      <li ><a href="/Wap/Server/index"><span class="am-icon-recycle"></span> 服务器</a></li>
      <li ><a href="/Wap/Customer/index"><span class="am-icon-user-md"></span>客户</a></li> 
      <li class="active"><a href="/Wap/Project/index"><span class="am-icon-briefcase"></span>项目</a></li>
    </ul>
    
</div>
<!-- footnav end -->

<script src="__ROOT__/Application/Home/View/default/assets/js/jquery.min.js"></script>

<script src="__ROOT__/Application/Home/View/default/assets/js/amazeui.min.js"></script>
<script src="__ROOT__/Application/Home/View/default/assets/js/app.js"></script>
</body>
</html>
